
class uiButterbar implements ng.IDirective{
    constructor(){}
    static instance():ng.IDirective{return new uiButterbar}
    templateUrl:string='<span class="bar"></span>';
    restrict:string='AC';
    link($scope,elements:ng.IAugmentedJQuery,attrs:ng.IAttributes){
        elements.addClass('butterbar hide');
                  $scope.$on('$stateChangeStart', function (event) {
                      (<any>window).$anchorScroll();
                      elements.removeClass('hide').addClass('active');
                  });
                  $scope.$on('$stateChangeSuccess', function (event, toState, toParams, fromState) {
                      event.targetScope.$watch('$viewContentLoaded', function () {
                          elements.addClass('hide').removeClass('active');
                      })
                  });
    }

}
angular.module('tms').directive('uiButterbar', uiButterbar.instance);